package com.everyline.lib_base.ext

import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleObserver
import androidx.lifecycle.OnLifecycleEvent
import com.everyline.lib_base.callback.livedata.BooleanLiveData

/**
 *creatd by 天天挂线
 *email:746608431@qq.com
 *on 2020/7/6
 *描述:TODO
 */
object KtxAppLifeObserver : LifecycleObserver {
    var isForeground = BooleanLiveData()

    @OnLifecycleEvent(Lifecycle.Event.ON_START)
    private fun onForeground() {
        isForeground.value = true
    }

    @OnLifecycleEvent(Lifecycle.Event.ON_STOP)
    private fun onBackground() {
        isForeground.value = false
    }
}